Source Code Viewer - Example 1 - FindCountryListByFormAction

package name.matthewgreet.example1.action;

import javax.servlet.http.HttpSession;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import com.opensymphony.xwork2.ActionSupport;

import name.matthewgreet.example1.common.AbstractActionSupport;
import name.matthewgreet.example1.vo.CountryList;

/**
 * Finds countries by first character of name.  
 */
@InterceptorRef("FormDrivenStack")
@Results({
	@Result(name=ActionSupport.INPUT, type="redirectAction", params = {"namespace", "/", "actionName", "ViewCountryList"}),
	@Result(name=ActionSupport.SUCCESS, type="redirectAction", params = {"namespace", "/", "actionName", "ViewCountryList"})
})
public class FindCountryListByFormAction extends AbstractActionSupport {
	private static final long serialVersionUID = -7979376337555804889L;
	
	private char firstChar;
	
    @Action("/FindCountryListByForm")
    @Override
    public String execute() throws Exception {
    	HttpSession session;
    	
    	session = getBrowserTabSession();
    	ViewCountryListAction.storeFirstChar(session, firstChar);
    	ViewCountryListAction.storeSearchResults(session, CountryList.getInstance().getByFirstLetter(firstChar));
		
		return SUCCESS;
    }

	public char getFirstChar() {
		return firstChar;
	}
	public void setFirstChar(char firstChar) {
		this.firstChar = firstChar;
	}

}